Skip to content

获取软件更新日志 - GetSoftUpdateLogs

函数简介

分页获取指定软件的正式版已发布版本更新日志列表,用于在客户端展示「版本历史 / 更新说明」页面。

获取软件更新状态 - GetSoftUpdateStatus 的区别:

接口用途
GetSoftUpdateStatus检测是否有新版本,并在有更新时返回最新一条版本的安装包信息。
GetSoftUpdateLogs返回多条历史版本的更新说明(不含下载地址),支持分页。

服务端仅返回 VersionType = 1(正式版)且 Status = 已发布 的记录;测试版、内测版、未发布版本不会暴露给客户端。

返回数据格式:

json
{
  "Code": 1,
  "Message": "success",
  "TotalCount": 12,
  "CurrentVersion": "1.0.0",
  "LatestVersion": "3.0.0",
  "Items": [
    {
      "Guid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "VersionNumber": "3.0.0",
      "VersionName": "正式版",
      "UpdateContent": "1. 修复登录问题\n2. 优化性能",
      "ReleaseDate": "2025-06-01T00:00:00",
      "PublishTime": "2025-06-01T10:30:00",
      "IsLatest": true,
      "IsForceUpdate": false,
      "IsCurrent": false
    }
  ]
}
字段名类型说明
Code整数结果状态码,通常 1 表示成功,0 表示失败(含软件不可用、参数错误等)。
Message字符串提示信息或错误信息;失败时多为 错误码:中文描述(如 "2003:参数无效")。成功时常为 success。完整对照见 客户端错误码说明
TotalCount整数符合条件的总条数(不受当前页大小影响)。
CurrentVersion字符串客户端上报的当前软件版本(回显)。
LatestVersion字符串最新正式版版本号。
Items数组当前页的更新日志列表。

常见错误码(Message 字段)

Message含义
2003:参数无效参数无效
2004:用户不存在用户不存在
2005:软件不可用或未开通软件不可用或未开通

Items 字段说明:

字段名类型说明
Guid字符串版本唯一标识。
VersionNumber字符串版本号,如 3.0.0
VersionName字符串版本名称。
UpdateContent字符串更新说明 / 变更日志正文。
ReleaseDate字符串对外发布日期。
PublishTime字符串系统发布时间。
IsLatest布尔是否为最新正式版。
IsForceUpdate布尔是否强制更新。
IsCurrent布尔是否等于请求参数中的 softVersion

接口名称

GetSoftUpdateLogs

DLL调用

long GetSoftUpdateLogs(string userCode, string softCode, string softVersion, string dealerCode, int skipCount, int maxResultCount);

参数说明

参数名类型说明
userCode字符串用户码。
softCode字符串软件码。
softVersion字符串当前软件版本(可选,用于标记 IsCurrent;传空字符串亦可)。
dealerCode字符串经销商码。
skipCount整数分页偏移,从 0 开始。
maxResultCount整数每页条数;传 0 时服务端默认 20,最大 100

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
OlaAuthSoftUpdateLogsReturn result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
// result.Code == 1 表示成功
// 第二页
OlaAuthSoftUpdateLogsReturn result2 = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 20, 20);
csharp
using OLAPlug;

var ola = new OLAPlugServer();
OlaAuthSoftUpdateLogsReturn result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
// result.Code == 1 表示成功
OlaAuthSoftUpdateLogsReturn result2 = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 20, 20);
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
json_result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20)
# Python SDK 返回 JSON 字符串,需自行解析
java
import com.olaplug.OLAPlugServer;
import com.olaplug.model.OlaAuthSoftUpdateLogsReturn;

OLAPlugServer ola = new OLAPlugServer();
OlaAuthSoftUpdateLogsReturn result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
// result.Code == 1 表示成功
go
import "github.com/ola/olaplug/olaplug"

ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
result := ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20)
// result.Code == 1 表示成功
result2 := ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 20, 20)
rust
use olaplug::OLAPlugServer;

let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
let result = ola.get_soft_update_logs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
// result.code == 1 表示成功
let result2 = ola.get_soft_update_logs("userCode", "softCode", "1.0.0", "dealerCode", 20, 20);
cpp
var ola = com("OlaPlug.OlaSoft")
var result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20)
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
Set result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20)
text
.局部变量 ola, OLAPlug
.局部变量 result, OlaAuthSoftUpdateLogsReturn
ola.创建 ()
result = ola.GetSoftUpdateLogs(“userCode”, “softCode”, “1.0.0”, “dealerCode”, 0, 20)
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var json = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
// Aardio SDK 返回 JSON 字符串,需自行解析
text
变量 ola <类型 = OLAPlugServer>
变量 result <类型 = OlaAuthSoftUpdateLogsReturn>
ola = 新建 OLAPlugServer
result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20)
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
OlaAuthSoftUpdateLogsReturn result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
// result.Code == 1 表示成功

原生 DLL 调用

cpp
long ptr = GetSoftUpdateLogs(instance, "userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
if (ptr != 0) {
    char buffer[2048] = {0};
    GetStringFromPtr(ptr, buffer, sizeof(buffer));
    FreeStringPtr(ptr);
}
csharp
using System.Runtime.InteropServices;
using System.Text;

[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringFromPtr(long ptr, StringBuilder lpString, int size);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int FreeStringPtr(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringSize(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long GetSoftUpdateLogs(string userCode, string softCode, string softVersion, string dealerCode, int skipCount, int maxResultCount);

long ptr = GetSoftUpdateLogs(instance, "userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
if (ptr != 0) {
    StringBuilder sb = new StringBuilder(GetStringSize(ptr) + 1);
    GetStringFromPtr(ptr, sb, sb.Capacity);
    FreeStringPtr(ptr);
    string result = sb.ToString();
}
python
from ctypes import CDLL, c_int, c_int64, create_string_buffer

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
ptr = ola.GetSoftUpdateLogs(instance, b"userCode", b"softCode", b"1.0.0", b"dealerCode", 0, 20)
if ptr:
    buf = create_string_buffer(2048)
    ola.GetStringFromPtr(ptr, buf, 2048)
    ola.FreeStringPtr(ptr)
    result = buf.value.decode("utf-8")

返回值

调用方式返回值说明
SDKOlaAuthSoftUpdateLogsReturn结构化返回对象;Code == 1 表示成功
原生 DLL非 0成功,返回 JSON 字符串格式的结果。
原生 DLL0失败。

注意事项

项目说明
释放内存返回的字符串指针需要调用 FreeStringPtr 接口释放内存。
数据范围仅包含正式版 + 已发布版本;测试版、内测版、待发布版本不会返回。
分页遍历根据 TotalCountskipCountmaxResultCount 循环请求直至取完所有页。
下载安装包本接口不返回 FileUrlFileMd5 等下载信息;需要下载地址时请使用 GetSoftUpdateStatus。若要自动下载并安装,请使用 SoftUpdateStart
登录前置建议先 Login 成功后再调用,确保用户码、软件码有效。